package com.test.controller;

import com.test.entity.RestBean;
import com.test.entity.dto.Notification;
import com.test.service.NotificationService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("api/notification")
public class NotificationController {
    @Resource
    NotificationService notificationService;

    @GetMapping("/deleteall")
    public RestBean<Void> deleteAll(@RequestParam int uid){
        notificationService.deleteAll(uid);
        return RestBean.success();
    }
    @GetMapping("/deleteone")
    public RestBean<Void> deleteOne(@RequestParam int id, @RequestParam int uid){
        notificationService.deleteOne(id,uid);
        return RestBean.success();
    }
    @GetMapping("getList")
    public RestBean<List<Notification>> getList( @RequestParam  int uid){
        return RestBean.success(notificationService.getNotifications(uid));
    }


}
